﻿using System;
using RepositoryFramework.Validators;
using FluentValidation;
using Portal.Model;

namespace Portal.Logic.Validators
{
	/// <summary>
	/// Class <see cref="UserValidator"/> define user validator
	/// </summary>
	public class UserValidator : BaseValidator<IUser>, IUserValidator
	{
		#region .ctor

		/// <summary>
		/// Initializes a new instance of the <see cref="UserValidator"/> class.
		/// </summary>
		public UserValidator()
		{
			RuleFor(x => x.Login)
				.NotEmpty()
				.Length(0, 50);
			RuleFor(x => x.FirstName)
				.Length(0, 50);
			RuleFor(x => x.LastName)
				.Length(0, 50);
		}

		#endregion .ctor
	}
}